package com.gavinwind.common.auth.config;

/**
 * 【权限授权事件类型枚举类】
 * @author chenxin
 * @version V1.0
 * @date 2017-9-11 下午3:52
 */
public enum ENUM_AUTH_EVENTTYPE {

    ACCESS("ACCESS","准入授权"),PAY("PAY","支付验证");
    private final String code;
    private final String desc;

    ENUM_AUTH_EVENTTYPE(String code ,String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String code() {
        return code;
    }

    public String desc() {
        return desc;
    }

    /**
     * 根据key获得desc
     * @param key
     * @return
     */
    public static String getEnumDescByKey(String key){
        for(ENUM_AUTH_EVENTTYPE enumItem:ENUM_AUTH_EVENTTYPE.values()){
            if(key.equals(enumItem.code())){
                return enumItem.desc();
            }
        }
        return "";
    }
}
